﻿using System;
using System.Collections.Generic;
using System.Text;

namespace DataMapper
{
    /// <summary>
    /// 表信息
    /// </summary>
    [AttributeUsage(AttributeTargets.Class)]
    [System.Serializable]
    public class TableInfoAttribute : Attribute
    {
        public TableInfoAttribute(string tableName)
        {
            TableName = tableName;
        }

        /// <summary>
        ///     数据库中表的名称
        /// </summary>
        public string TableName { get; set; }

        /// <summary>
        ///     获取元数据的特性
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public static TableInfoAttribute GetAttribute(Type item)
        {
            var excludeFieldAttribute = (TableInfoAttribute)GetCustomAttribute(item, typeof(TableInfoAttribute));
            return excludeFieldAttribute;
        }
    }
}
